package cccc;

public class T {
    Cell[] cells = new Cell[4];


    //构造方法目的: 初始化成员变量
    public T() {
        cells[0] = new Cell(5,0);
        cells[1] = new Cell(6,0);
        cells[2] = new Cell(7,0);
        cells[3] = new Cell(6,1);
    }

    public T(Cell[] cells) {
        this.cells = cells;
    }

    //成员方法(画T)
    public void printT(){
        int totalCol = 10;
        int totalRow = 20;
        for (int col = 0; col < totalCol; col++) {//20
            for (int row = 0; row < totalRow; row++) {//10
                boolean flag = false;
                //比较4个方块和当前的位置是否相等
                //遍历的cells数组
                for (int i = 0; i < cells.length; i++) {//4
                    //cells[0] cells[1] cells[2]
                    if(cells[i].col == col && cells[i].row == row){
                        //* ---
                        System.out.print("*");
                        flag = true;
                        break;
                    }/*else {
                        //----
                        System.out.print("-");
                    }*/
                }
                //当flag状态为 false的时候画- !flag = false
                if (!flag){
                    System.out.print("-");
                }
            }
            System.out.println();
        }
    }
}
